<!--
 * @Description: 公告详情
 * @Author:  zhangweigang
 * @Date: 2021-03-06 15:07:41
 * @LastEditTime: 2021-05-04 22:54:58
 * @LastEditors: zhangweigang
-->

<template>
  <div>
    <Header></Header>
    <div class="content-lcoal">
      <strong>当前位置：</strong>
      <span class="index" @click="returnIndex">首页</span>
      --><span class="index" @click="back">公告列表</span>
    </div>
    <div class="contain">
      <h2>{{ detialInfo.noticeTitle }}</h2>
      <div class="sub-title">
        <span>发布者：{{ detialInfo.creator }}</span>
        <span>发布时间：{{ detialInfo.createDate }}</span>
      </div>
      <div class="author-contant">
        <div class="content_News"></div>
        <div class="remark">
          <p>来源：</p>
          <p>{{ detialInfo.remark }}</p>
        </div>
      </div>
    </div>
    <Footer></Footer>
  </div>
</template>

<script>
import { getAnnounceByIdDetail } from '../../network/product.js';
export default {
  data() {
    return {
      detialInfo: {}
    };
  },
  // 当实例挂载完成之后执行
  mounted() {
    this.getNotice();
  },
  methods: {
    returnIndex() {
      this.$router.push('/home');
    },
    back() {
      this.$router.go(-1);
    },
    // 获取最新通知公告
    getNotice() {
      let content_NewsDom = document.querySelector('.content_News');
      console.log(this.$route.params, '传参ID值');
      getAnnounceByIdDetail(this.$route.params.id).then((res) => {
        console.log(res, '数据');
        let data = res.data.data;
        console.log(data, '数据');
        if (res.status === 200 && res.data.code === 0) {
          console.log(res.data, '成功');
          this.detialInfo = {
            noticeTitle: data.noticeTitle,
            creator: data.creator,
            createDate: data.createDate,
            noticeContent: data.noticeContent,
            remark: data.remark
          };
          content_NewsDom.innerHTML = data.noticeContent;
          console.log(this.detialInfo, 'cunzai');
        } else {
          console.log(res.data, '失败');
        }
      });
    }
  }
};
</script>

<style lang="less" scoped>
.contain {
  h2 {
    text-align: center;
    color: #333;
  }
  .sub-title {
    height: 50px;
    line-height: 50px;
    text-align: right;
    padding: 0 20px;
    span {
      color: #333;
      display: inline-block;
      padding: 0 10px;
    }
  }
}
.remark {
  width: 100%;
  height: 40px;
  line-height: 40px;
  text-align: right;
  padding: 0 20px;
  p {
    display: inline-block;
    text-indent: 0 !important;
    font-weight: bold;
  }
}
.author-contant {
  p {
    color: #333;
    text-indent: 32px;
    font-size: 16px;
    line-height: 28px;
    font-family: '微软雅黑';
    letter-spacing: 1px;
  }
}
.index {
  cursor: pointer;
}
.content-lcoal {
  position: relative;
}
.content_News {
  font-size: 16px;
  text-indent: 32px;
  color: #333;
  width: 100%;
  margin: 3px 0;
}
</style>
